Skip to content

Making regression test put()'s transactional.#562

Merged
dhermes merged 1 commit intogoogleapis:masterfrom
dhermes:regression-transactional-puts
Jan 22, 2015
Merged

Making regression test put()'s transactional.#562
dhermes merged 1 commit intogoogleapis:masterfrom
dhermes:regression-transactional-puts

Conversation

@dhermes
Copy link
Copy Markdown
Contributor

@dhermes dhermes commented Jan 22, 2015

This is to address flaky test failures.

See #535 for more discussion.

This is to address flaky test failures.

See googleapis#535 for more discussion.
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 22, 2015
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling e407a68 on dhermes:regression-transactional-puts into 1bfa469 on GoogleCloudPlatform:master.

@tseaver
Copy link
Copy Markdown
Contributor

tseaver commented Jan 22, 2015

LGTM

dhermes added a commit that referenced this pull request Jan 22, 2015
Making regression test put()'s transactional.
@dhermes dhermes merged commit 927c534 into googleapis:master Jan 22, 2015
@dhermes dhermes deleted the regression-transactional-puts branch January 22, 2015 19:13
@dhermes
Copy link
Copy Markdown
Contributor Author

dhermes commented Jan 22, 2015

The second time regression tests were run after this PR, the flake still occurred:
https://travis-ci.org/GoogleCloudPlatform/gcloud-python/builds/47970589

======================================================================
FAIL: test_save_key_self_reference (datastore.TestDatastoreSaveKeys)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/GoogleCloudPlatform/gcloud-python/regression/datastore.py", line 158, in test_save_key_self_reference
    self.assertEqual(len(stored_persons), 1)
AssertionError: 0 != 1

The code at question is

        with datastore.Transaction():
            datastore.put([entity])

        query = datastore.Query(kind='Person')
        query.add_filter('linkedTo', '=', key)

        stored_persons = list(query.fetch(limit=2))
        self.assertEqual(len(stored_persons), 1)

@pcostell does the runQuery request also need to occur transactionally to make sure this passes always?

@pcostell
Copy link
Copy Markdown
Contributor

This doesn't actually do anything (a single put by itself is transactional).

To make sure these tests always pass you need to make the entity have a parent then make the query do an ancestor query.

@dhermes
Copy link
Copy Markdown
Contributor Author

dhermes commented Jan 22, 2015

Thanks. Sorry for the n00b question. I've been told that before, totally should not have forgotten.

@tseaver I'll jump on fixing this.

@pcostell
Copy link
Copy Markdown
Contributor

No worries, it's easy to mix up.

dhermes added a commit to dhermes/google-cloud-python that referenced this pull request Jan 22, 2015
Using an ancestor in queries to ensure consistency.

See googleapis#562 for context.
dhermes added a commit to dhermes/google-cloud-python that referenced this pull request Jan 27, 2015
Using an ancestor in queries to ensure consistency.

See googleapis#562 for context.
vchudnov-g pushed a commit that referenced this pull request Sep 20, 2023
Source-Link: googleapis/synthtool@fdba3ed
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1f0dbd02745fb7cf255563dab5968345989308544e52b7f460deadd5e78e63b0
parthea pushed a commit that referenced this pull request Sep 22, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Oct 21, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea added a commit that referenced this pull request Nov 24, 2025
…eam caught unexpected exception and will exit` (#562)

* chore: partial revert of PR #357

This reverts commit e120a0cdb589d390848b0711ff21c9ff4aab26a9.

* add comment
parthea pushed a commit that referenced this pull request Nov 26, 2025
parthea added a commit that referenced this pull request Mar 2, 2026
Source-Link: googleapis/synthtool@69fda12
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants